package com.yogurt.oss.controller;

import com.yogurt.oss.service.OssService;
import com.yogurt.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Auther: 酸奶
 * @Date: 2020/07/08 15:26
 * @Description: oss上传控制器
 */

@RestController
@RequestMapping("/eduoss")
@CrossOrigin
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping("/upload")
    public Result uploadAvatar(MultipartFile file){
        String url = ossService.uploadAvatar(file);
        return Result.ok().data("url",url);
    }
}
